load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "checkpoint",
    srcs = [
        "backup.go",
        "checkpoint.go",
        "log_restore.go",
        "restore.go",
        "ticker.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/checkpoint",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/logutil",
        "//br/pkg/metautil",
        "//br/pkg/pdutil",
        "//br/pkg/rtree",
        "//br/pkg/storage",
        "//br/pkg/summary",
        "//br/pkg/utils",
        "//parser/model",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//oracle",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "checkpoint_test",
    timeout = "short",
    srcs = ["checkpoint_test.go"],
    flaky = True,
    race = "on",
    shard_count = 5,
    deps = [
        ":checkpoint",
        "//br/pkg/pdutil",
        "//br/pkg/storage",
        "//parser/model",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/encryptionpb",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
    ],
)
